{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[ 2.39784666]\n",
      " [ 3.82528748]] 4.28831566186 8.73976925473\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYAAAAD8CAYAAAB+UHOxAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHm5JREFUeJzt3XuQXOWd3vHv05eZ0f2CRkKRhAVGsMvWFpgooC1iUmts\ncYljkc2SYuMKipeUditsyq5sKovjVHDsdZW9qdi71K7ZYo3WwvEaY3tdKC5irICd3WwtGHETYFlo\nABvGEtLA6H4ZzeWXP87bo55Rd8+MpOkeTj+fqq5z+u23T799pmeeed/z9jmKCMzMrP0UWt0AMzNr\nDQeAmVmbcgCYmbUpB4CZWZtyAJiZtSkHgJlZm3IAmJm1KQeAmVmbcgCYmbWpUqsb0MiSJUti9erV\nrW6Gmdm7yjPPPPN2RHRPVG9GB8Dq1avZvn17q5thZvauIunnk6nnISAzszblADAza1MOADOzNuUA\nMDNrUw4AM7M25QAwM2tTDgAzszaVywDYe+gEX/zBLl7rO9rqppiZzVi5DID9hwe494keXn/7WKub\nYmY2Y+UyAEpFATA47Avem5nVk8sAKBeztzU0MtLilpiZzVy5DIBSIesBDLkHYGZW14QBIOlySc9X\n3Q5L+oSkxZK2SdqdlotSfUm6V1KPpB2Srq7a1sZUf7ekjdP1pio9gMFh9wDMzOqZMAAiYldEXBUR\nVwH/EDgOfBe4G3g8ItYAj6f7ADcDa9JtE3AfgKTFwD3AtcA1wD2V0DjfKscAhkbcAzAzq2eqQ0A3\nAK9GxM+BDcCWVL4FuDWtbwAejMyTwEJJy4EbgW0R0R8RB4BtwE3n/A5qKBXSMQD3AMzM6ppqANwO\nfCOtL4uIvQBpuTSVrwDerHpObyqrVz6GpE2Stkva3tfXN8XmZcqeBWRmNqFJB4CkDuAjwLcm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LRe3oG2zgXeABVVlTd9nZAG0Fxgk+8/rznr7h6xr/mfpM/ci\nsLbJ7eohGxuufM7+PNX9F+nn+wLwLPDPWrDP6v7sgE+lfbYLuLmZ7UrlXwV+d1zdpu2zBn8jmvI5\n8zeBzczaVB6HgMzMbBIcAGZmbcoBYGbWphwAZmZtygFgZtamHABmZm3KAWBm1qYcAGZmber/A7f7\n2rG85LNEAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x1118ebcc0>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "\n",
    "\n",
    "x = np.random.random((1000,2))\n",
    "\n",
    "w = np.array([[2.4],[3.9]])\n",
    "b = 4.2\n",
    "\n",
    "y = np.dot(x, w) + b\n",
    "y = y + 0.1 * np.random.random(1000).reshape(1000,1)\n",
    "\n",
    "w_ = np.random.randn(2,1)\n",
    "b_ = 0\n",
    "\n",
    "\n",
    "lr = 0.0001\n",
    "epochs = 200\n",
    "\n",
    "a = []\n",
    "for e in range(epochs):\n",
    "    w_ = w_ - lr * 2 * np.dot(x.T, (np.dot(x, w_) + b_ - y))\n",
    "    b_ = b_ - lr * 2 * (np.dot(x, w_) + b_ - y).sum()\n",
    "    a.append(((np.dot(x, w_) + b - y)**2).sum())\n",
    "    \n",
    "print(w_, b_, a[-1])\n",
    "plt.plot(np.arange(epochs),a)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
